package pl.plesken.swt;

import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.LinkedList;
import java.util.NoSuchElementException;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;

import pl.plesken.graphic.CreateCoverImage;
import pl.plesken.languages.SetLanguage;
import pl.plesken.tabs.MenuTab;
import pl.plesken.tools.ListDir;
import pl.plesken.tools.MovieJukeBoxConfig;
import pl.plesken.tools.SortXMLFiles;
import pl.plesken.xml.ConfigParser;
import pl.plesken.xml.HostsXML;
import pl.plesken.xml.LibrariesXML;

import com.swtdesigner.SWTResourceManager;

public class MainFrame {

	private Combo reflectionPostCombo;
	private Combo reflectionThumbCombo;
	private Combo postLogoTVCombo;
	private Combo ratingCombo;
	private Combo postLogoHDCombo;
	private Combo postPerspCombo;
	private Combo thumbLogoTVCombo;
	private Combo thumbLogoHDCombo;
	private Combo thumbPerspCombo;
	private Button coverRunButton;
	private Button runButton;
	private Table editTable;
//	LinkedList<String> saveCfgXML = new LinkedList<String>();
	LinkedList<MenuTab> saveCfgXML = new LinkedList<MenuTab>();
	LinkedList<String> ListXMLFiles = new LinkedList<String>();
	private Text destText;
	private Table table;
	private Text passwordText;
	private Text userText;
	private Combo opnSbtCombo;
	private Combo theTVDBcombo;
	private Combo languageCombo;
	private Combo skinCombo;
	private ConfigParser cnf = new ConfigParser();
	private Text mediaText;
	private Combo pluginCombo;
	protected Shell shell;
	StringBuffer localdisk = new StringBuffer();
	StringBuffer usbdisk = new StringBuffer();
	StringBuffer smbdisk = new StringBuffer();
	StringBuffer nfsdisk = new StringBuffer();
	StringBuffer http = new StringBuffer();
	StringBuffer nmtpath = new StringBuffer();
	StringBuffer nmtxlspath = new StringBuffer();
	StringBuffer run = new StringBuffer();
	StringBuffer libxml = new StringBuffer();
	StringBuffer cfg = new StringBuffer();
	StringBuffer SourcePath = new StringBuffer();
	StringBuffer name = new StringBuffer();
	StringBuffer src = new StringBuffer();
	StringBuffer nmt = new StringBuffer();
	StringBuffer excl = new StringBuffer();
	StringBuffer sign = new StringBuffer();
	StringBuffer stat = new StringBuffer();
	StringBuffer editXMLFile = new StringBuffer();
	StringBuffer setDisableMJB = new StringBuffer();
	StringBuffer setEnableCover = new StringBuffer();
	StringBuffer myihome = new StringBuffer();
	
/*	public LinkedList<String> getSaveCfgXML() {
		return saveCfgXML;
	}

	public void setSaveCfgXML(LinkedList<String> saveCfgXML) {
		this.saveCfgXML = saveCfgXML;
	}*/

	public LinkedList<String> getListXMLFiles() {
		return ListXMLFiles;
	}
	
	public LinkedList<MenuTab> getSaveCfgXML() {
		return saveCfgXML;
	}

	public void setSaveCfgXML(LinkedList<MenuTab> saveCfgXML) {
		this.saveCfgXML = saveCfgXML;
	}

	/**
	 * Launch the application
	 * @param args
	 */
	public static void main(String[] args) {
		try {		
			MainFrame window = new MainFrame();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window
	 */
	public void open() {
		final Display display = Display.getDefault();
		createContents();
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
	}

	/**
	 * Create contents of the window
	 */
	protected void createContents() {
		shell = new Shell();
		shell.setImage(SWTResourceManager.getImage(MainFrame.class, "/icons/gui.png")); //$NON-NLS-1$
		final GridLayout gridLayout_6 = new GridLayout();
		shell.setLayout(gridLayout_6);
		shell.setSize(613, 538);
		shell.setText("GUI MovieJukeBox"); //$NON-NLS-1$
		
		ListDir load = new ListDir();
		File GUIPath = new File("conf/GUI.xml"); //$NON-NLS-1$
		
		//if (!GUIPath.exists() || cnf.readPath("GUIpath").equals("")) {
		if (!GUIPath.exists() || cnf.readConf("GUIpath").equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
			GUIPathConfig s = new GUIPathConfig(shell);
			s.open();
		}
		
		String lang = cnf.readConf("language"); //$NON-NLS-1$
		SetLanguage.setLang(lang);
		String media = cnf.readConf("media"); //$NON-NLS-1$
		String skin = cnf.readConf("skin"); //$NON-NLS-1$
		
		final TabFolder guiTabFolder = new TabFolder(shell, SWT.NONE);
		final GridData gd_guiTabFolder = new GridData(SWT.FILL, SWT.FILL, true, true);
		guiTabFolder.setLayoutData(gd_guiTabFolder);
		
		//hosts
		final TabItem hostsTabItem = new TabItem(guiTabFolder, SWT.NONE);
		hostsTabItem.setText(SetLanguage.getString("MainFrame.servers")); //$NON-NLS-1$

		final Composite mainComposite = new Composite(guiTabFolder, SWT.NONE);
		final GridLayout gridLayout_4 = new GridLayout();
		mainComposite.setLayout(gridLayout_4);
		hostsTabItem.setControl(mainComposite);

		final Group mainTableGroup = new Group(mainComposite, SWT.NONE);
		final GridData gd_mainTableGroup = new GridData(SWT.FILL, SWT.FILL, true, true);
		mainTableGroup.setLayoutData(gd_mainTableGroup);
		mainTableGroup.setLayout(new GridLayout());

		table = new Table(mainTableGroup, SWT.MULTI | SWT.BORDER);
		table.addMouseListener(new MouseAdapter() {
			public void mouseDoubleClick(final MouseEvent e) {
				openHostConfig();
			}
		});
		table.setLinesVisible(true);
		table.setHeaderVisible(true);
		table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

		final TableColumn hostColumnTableColumn = new TableColumn(table, SWT.NONE);
		hostColumnTableColumn.setWidth(150);
		hostColumnTableColumn.setText(SetLanguage.getString("MainFrame.nameOfServer")); //$NON-NLS-1$

		final TableColumn pathTableColumn = new TableColumn(table, SWT.NONE);
		pathTableColumn.setWidth(200);
		pathTableColumn.setText(SetLanguage.getString("MainFrame.sourcePath")); //$NON-NLS-1$

		final TableColumn nmtTableColumn = new TableColumn(table, SWT.NONE);
		nmtTableColumn.setWidth(150);
		nmtTableColumn.setText(SetLanguage.getString("MainFrame.destinationPathOrHost")); //$NON-NLS-1$

		final TableColumn exclTableColumn = new TableColumn(table, SWT.NONE);
		exclTableColumn.setWidth(0);
		exclTableColumn.setText("Excl"); //$NON-NLS-1$
		
		final TableColumn actTableColumn = new TableColumn(table, SWT.NONE);
		actTableColumn.setWidth(0);
		actTableColumn.setText("Act"); //$NON-NLS-1$
		
		final TableColumn showActTableColumn = new TableColumn(table, SWT.NONE);
		showActTableColumn.setWidth(100);
		showActTableColumn.setText(SetLanguage.getString("MainFrame.status")); //$NON-NLS-1$
		
		final TableColumn nmtSignTableColumn = new TableColumn(table, SWT.NONE);
		nmtSignTableColumn.setWidth(0);
		nmtSignTableColumn.setText("SignNMT"); //$NON-NLS-1$
		
		//Load config:
		
		HostsXML xmlHosts = new HostsXML();
		xmlHosts.readHostValues();
		
		for (int i = 0; i < xmlHosts.getRow().size(); i++) {
			TableItem it = new TableItem(table, SWT.NULL);

			it.setText(0, xmlHosts.getRow().get(i).getName());
			it.setText(1, xmlHosts.getRow().get(i).getSrc());
			it.setText(2, xmlHosts.getRow().get(i).getNmt());
			it.setText(3, xmlHosts.getRow().get(i).getExcl());
			it.setText(4, xmlHosts.getRow().get(i).getStat());
			
			if (xmlHosts.getRow().get(i).getStat().equals("enable")) {
				it.setText(5, SetLanguage.getString("MainFrame.statusEnabled")); //$NON-NLS-1$
			} else {
				it.setText(5, SetLanguage.getString("MainFrame.statusDisabled")); //$NON-NLS-1$
			}
			
			it.setText(6, xmlHosts.getRow().get(i).getSign());
			
			/*String[] tab = xmlHosts.getRow().get(i).split("<BREAK>"); //$NON-NLS-1$

			if (!tab[0].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(0, tab[0].toString());
			} else {
				it.setText(0, ""); //$NON-NLS-1$
			}
			if (!tab[1].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(1, tab[1].toString());
			} else {
				it.setText(1, ""); //$NON-NLS-1$
			}
			if (!tab[2].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(2, tab[2].toString());
			} else {
				it.setText(2, ""); //$NON-NLS-1$
			}
			if (!tab[3].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(3, tab[3].toString());
			} else {
				it.setText(3, ""); //$NON-NLS-1$
			}
			if (!tab[5].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(4, tab[5].toString());
			} else {
				it.setText(4, ""); //$NON-NLS-1$
			}
			if (tab[5].toString().equals("enable")) { //$NON-NLS-1$ //$NON-NLS-2$
				it.setText(5, SetLanguage.getString("MainFrame.statusEnabled")); //$NON-NLS-1$
			} else {
				it.setText(5, SetLanguage.getString("MainFrame.statusDisabled")); //$NON-NLS-1$
			}
			if (!tab[4].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(6, tab[4].toString());
			} else {
				it.setText(6, ""); //$NON-NLS-1$
			}*/
		}
		
		/*ConfigXML key = new ConfigXML();
		key.parseConfXML();
		
		for (int i = 0; i < key.getRow().size(); i++) {
			TableItem it = new TableItem(table, SWT.NULL);
			String[] tab = key.getRow().get(i).split(";"); //$NON-NLS-1$
			//System.out.println("row: " + key.getRow().get(i) + "\ntab: " + tab[0]);
			if (!tab[0].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(0, tab[0].toString());
			} else {
				it.setText(0, ""); //$NON-NLS-1$
			}
			if (!tab[1].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(1, tab[1].toString());
			} else {
				it.setText(1, ""); //$NON-NLS-1$
			}
			if (!tab[2].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(2, tab[2].toString());
			} else {
				it.setText(2, ""); //$NON-NLS-1$
			}
			if (!tab[3].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(3, tab[3].toString());
			} else {
				it.setText(3, ""); //$NON-NLS-1$
			}
			if (!tab[5].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(4, tab[5].toString());
			} else {
				it.setText(4, ""); //$NON-NLS-1$
			}
			if (tab[5].toString().equals("enable")) { //$NON-NLS-1$ //$NON-NLS-2$
				it.setText(5, SetLanguage.getString("MainFrame.statusEnabled")); //$NON-NLS-1$
			} else {
				it.setText(5, SetLanguage.getString("MainFrame.statusDisabled")); //$NON-NLS-1$
			}
			if (!tab[4].toString().equals("empty")) { //$NON-NLS-1$
				it.setText(6, tab[4].toString());
			} else {
				it.setText(6, ""); //$NON-NLS-1$
			}
		}*/
		
		final Group mainDestPathGroup = new Group(mainComposite, SWT.NONE);
		final GridData gd_mainDestPathGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
		mainDestPathGroup.setLayoutData(gd_mainDestPathGroup);
		final GridLayout gridLayout_5 = new GridLayout();
		gridLayout_5.numColumns = 3;
		mainDestPathGroup.setLayout(gridLayout_5);

		final Label manageHostLabel = new Label(mainDestPathGroup, SWT.NONE);
		manageHostLabel.setText(SetLanguage.getString("MainFrame.manage")); //$NON-NLS-1$

		final Button button_1 = new Button(mainDestPathGroup, SWT.NONE);
		button_1.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				delHost();
			}
		});
		final GridData gd_button_1 = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
		gd_button_1.widthHint = 63;
		button_1.setLayoutData(gd_button_1);
		button_1.setText(SetLanguage.getString("MainFrame.delete")); //$NON-NLS-1$

		final Button addHostButton = new Button(mainDestPathGroup, SWT.NONE);
		addHostButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				addHost();
			}
		});
		final GridData gd_addHostButton = new GridData(SWT.FILL, SWT.CENTER, false, false);
		gd_addHostButton.widthHint = 63;
		addHostButton.setLayoutData(gd_addHostButton);
		addHostButton.setText(SetLanguage.getString("MainFrame.add")); //$NON-NLS-1$

		final Label destLabel = new Label(mainDestPathGroup, SWT.NONE);
		final GridData gd_destLabel = new GridData(SWT.FILL, SWT.CENTER, false, false);
		gd_destLabel.widthHint = 180;
		destLabel.setLayoutData(gd_destLabel);
		destLabel.setText(SetLanguage.getString("MainFrame.destinationDir")); //$NON-NLS-1$

		destText = new Text(mainDestPathGroup, SWT.BORDER);
		final GridData gd_destText = new GridData(SWT.FILL, SWT.CENTER, true, false);
		destText.setLayoutData(gd_destText);

		final Button destButton = new Button(mainDestPathGroup, SWT.NONE);
		destButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				selectDestinationDir();
			}
		});
		final GridData gd_destButton = new GridData(SWT.FILL, SWT.CENTER, false, false);
		gd_destButton.widthHint = 63;
		destButton.setLayoutData(gd_destButton);
		destButton.setText(SetLanguage.getString("MainFrame.select")); //$NON-NLS-1$
		//end hosts
		
		final TabItem setTabItem = new TabItem(guiTabFolder, SWT.NONE);
		setTabItem.setText(SetLanguage.getString("MainFrame.settings")); //$NON-NLS-1$

		final Composite settingsComposite = new Composite(guiTabFolder, SWT.NONE);
		settingsComposite.setLayout(new GridLayout());
		setTabItem.setControl(settingsComposite);

		Group settingsGroup;
		settingsGroup = new Group(settingsComposite, SWT.NONE);
		settingsGroup.setText(SetLanguage.getString("MainFrame.groupBasic")); //$NON-NLS-1$
		final GridData gd_settingsGroup = new GridData(SWT.FILL, SWT.FILL, true, true);
		settingsGroup.setLayoutData(gd_settingsGroup);
		final GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 3;
		settingsGroup.setLayout(gridLayout);

		final Label searchPluginLabel = new Label(settingsGroup, SWT.NONE);
		final GridData gd_searchPluginLabel = new GridData(SWT.FILL, SWT.CENTER, false, false);
		gd_searchPluginLabel.heightHint = 31;
		searchPluginLabel.setLayoutData(gd_searchPluginLabel);
		searchPluginLabel.setText(SetLanguage.getString("MainFrame.searchPlugin")); //$NON-NLS-1$
		new Label(settingsGroup, SWT.NONE);
		new Label(settingsGroup, SWT.NONE);

		final Label internetPluginLabel = new Label(settingsGroup, SWT.NONE);
		final GridData gd_internetPluginLabel = new GridData(SWT.FILL, SWT.CENTER, true, false);
		internetPluginLabel.setLayoutData(gd_internetPluginLabel);
		internetPluginLabel.setText("mjb.internet.plugin ="); //$NON-NLS-1$

		pluginCombo = new Combo(settingsGroup, SWT.READ_ONLY);
		//pluginCombo.setItems(new String[] {"com.moviejukebox.plugin.ImdbPlugin", "com.moviejukebox.plugin.FilmwebPlugin", "com.moviejukebox.plugin.AllocinePlugin"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		pluginCombo.setItems(cnf.readConf("plugins").split(",")); //$NON-NLS-1$ //$NON-NLS-2$
		final GridData gd_pluginCombo = new GridData(SWT.FILL, SWT.CENTER, true, false);
		pluginCombo.setLayoutData(gd_pluginCombo);
		if (!cnf.readConf("plugin").equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
			pluginCombo.setText(cnf.readConf("plugin")); //$NON-NLS-1$
		}
		new Label(settingsGroup, SWT.NONE);

		final Label label_6 = new Label(settingsGroup, SWT.NONE);
		final GridData gd_label_6 = new GridData(SWT.FILL, SWT.CENTER, false, false);
		gd_label_6.heightHint = 32;
		label_6.setLayoutData(gd_label_6);
		label_6.setText(SetLanguage.getString("MainFrame.mediaInfoPath")); //$NON-NLS-1$
		new Label(settingsGroup, SWT.NONE);
		new Label(settingsGroup, SWT.NONE);

		final Label mediainfohomeLabel = new Label(settingsGroup, SWT.NONE);
		final GridData gd_mediainfohomeLabel = new GridData(SWT.FILL, SWT.CENTER, false, false);
		mediainfohomeLabel.setLayoutData(gd_mediainfohomeLabel);
		mediainfohomeLabel.setText("mediainfo.home ="); //$NON-NLS-1$

		mediaText = new Text(settingsGroup, SWT.BORDER);
		final GridData gd_mediaText = new GridData(SWT.FILL, SWT.CENTER, true, false);
		if (media.equals("")) { //$NON-NLS-1$
			mediaText.setText(""); //$NON-NLS-1$
		} else if (!media.equals("")) { //$NON-NLS-1$
			mediaText.setText(media);
		}
		mediaText.setLayoutData(gd_mediaText);

		final Button openButton = new Button(settingsGroup, SWT.NONE);
		openButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				mediaDir();
			}
		});
		openButton.setText(SetLanguage.getString("MainFrame.open")); //$NON-NLS-1$

		final Label skinLabel = new Label(settingsGroup, SWT.NONE);
		final GridData gd_skinLabel = new GridData(SWT.FILL, SWT.CENTER, false, false);
		skinLabel.setLayoutData(gd_skinLabel);
		skinLabel.setText(SetLanguage.getString("MainFrame.skin")); //$NON-NLS-1$
		new Label(settingsGroup, SWT.NONE);
		new Label(settingsGroup, SWT.NONE);

		final Label skinPath = new Label(settingsGroup, SWT.NONE);
		final GridData gd_skinPath = new GridData(SWT.FILL, SWT.CENTER, false, false);
		skinPath.setLayoutData(gd_skinPath);
		skinPath.setText("mjb.skin.dir = "); //$NON-NLS-1$

		skinCombo = new Combo(settingsGroup, SWT.READ_ONLY);
		//skinCombo.setItems(new String[] {"default", "mixed", "gfb107", "gfb107-sd", "hebrew", "robinsjexcal", "sd"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
		skinCombo.setItems(load.list("skins").split(",")); //$NON-NLS-1$ //$NON-NLS-2$
		final GridData gd_skinCombo = new GridData(SWT.LEFT, SWT.CENTER, true, false);
		skinCombo.setLayoutData(gd_skinCombo);
		if (!cnf.readConf("skin").equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
			skinCombo.setText(cnf.readConf("skin")); //$NON-NLS-1$
		}
		new Label(settingsGroup, SWT.NONE);

		final Label label_sep = new Label(settingsGroup, SWT.NONE);
		label_sep.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		new Label(settingsGroup, SWT.NONE);
		new Label(settingsGroup, SWT.NONE);
		new Label(settingsGroup, SWT.NONE);
		new Label(settingsGroup, SWT.NONE);

		final Button saveButton2 = new Button(settingsGroup, SWT.NONE);
		saveButton2.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				saveOptions();
			}
		});
		final GridData gd_saveButton2 = new GridData();
		saveButton2.setLayoutData(gd_saveButton2);
		saveButton2.setText(SetLanguage.getString("MainFrame.save")); //$NON-NLS-1$

		final Group advancedGroup = new Group(settingsComposite, SWT.NONE);
		final GridData gd_advancedGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
		advancedGroup.setLayoutData(gd_advancedGroup);
		advancedGroup.setText(SetLanguage.getString("MainFrame.groupAdvance")); //$NON-NLS-1$
		final GridLayout gridLayout_2 = new GridLayout();
		gridLayout_2.numColumns = 4;
		advancedGroup.setLayout(gridLayout_2);

		final Button propertiesButton = new Button(advancedGroup, SWT.NONE);
		propertiesButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				properties();
			}
		});
		final GridData gd_propertiesButton = new GridData(SWT.CENTER, SWT.CENTER, true, false);
		gd_propertiesButton.widthHint = 95;
		propertiesButton.setLayoutData(gd_propertiesButton);
		propertiesButton.setText(SetLanguage.getString("MainFrame.propertiesButton")); //$NON-NLS-1$

		final Button guiPathButton = new Button(advancedGroup, SWT.NONE);
		guiPathButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				setGUIPath();
			}
		});
		final GridData gd_guiPathButton = new GridData(SWT.CENTER, SWT.CENTER, true, false);
		gd_guiPathButton.widthHint = 95;
		guiPathButton.setLayoutData(gd_guiPathButton);
		guiPathButton.setText(SetLanguage.getString("MainFrame.guiPathButton")); //$NON-NLS-1$

		final Button categoriesButton = new Button(advancedGroup, SWT.NONE);
		categoriesButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				categories();
			}
		});
		final GridData gd_categoriesButton = new GridData(SWT.CENTER, SWT.CENTER, true, false);
		gd_categoriesButton.widthHint = 95;
		categoriesButton.setLayoutData(gd_categoriesButton);
		categoriesButton.setText(SetLanguage.getString("MainFrame.categoriesButton")); //$NON-NLS-1$

		final Button genresButton = new Button(advancedGroup, SWT.NONE);
		genresButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				genres();
			}
		});
		final GridData gd_genresButton = new GridData(SWT.CENTER, SWT.CENTER, true, false);
		gd_genresButton.widthHint = 95;
		genresButton.setLayoutData(gd_genresButton);
		genresButton.setText(SetLanguage.getString("MainFrame.gengresButton")); //$NON-NLS-1$
		
		final TabItem languageTabItem = new TabItem(guiTabFolder, SWT.NONE);
		languageTabItem.setText(SetLanguage.getString("MainFrame.language")); //$NON-NLS-1$

		final Composite languageComposite = new Composite(guiTabFolder, SWT.NONE);
		languageComposite.setLayout(new GridLayout());
		languageTabItem.setControl(languageComposite);

		final Group languageGroup = new Group(languageComposite, SWT.NONE);
		final GridData gd_languageGroup = new GridData(SWT.FILL, SWT.FILL, true, true);
		languageGroup.setLayoutData(gd_languageGroup);
		final GridLayout gridLayout_1 = new GridLayout();
		gridLayout_1.numColumns = 2;
		languageGroup.setLayout(gridLayout_1);

		final Label languageSepLabel0 = new Label(languageGroup, SWT.NONE);
		new Label(languageGroup, SWT.NONE);

		final Label langTextLabel = new Label(languageGroup, SWT.NONE);
		final GridData gd_langTextLabel = new GridData(SWT.FILL, SWT.CENTER, true, false);
		gd_langTextLabel.heightHint = 24;
		gd_langTextLabel.widthHint = 155;
		langTextLabel.setLayoutData(gd_langTextLabel);
		langTextLabel.setText(SetLanguage.getString("MainFrame.selectAppLanguage")); //$NON-NLS-1$

		languageCombo = new Combo(languageGroup, SWT.READ_ONLY);
		languageCombo.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				cnf.saveConf("language", languageCombo.getText(), "conf/GUI.xml"); //$NON-NLS-1$ //$NON-NLS-2$
				shell.close();
				MainFrame re = new MainFrame();
				re.open();
			}
		});
		languageCombo.setItems(new String[] {"English", "Polski"}); //$NON-NLS-1$ //$NON-NLS-2$
		final GridData gd_languageCombo = new GridData(SWT.LEFT, SWT.CENTER, true, false);
		gd_languageCombo.widthHint = 117;
		if (!cnf.readConf("language").equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
			languageCombo.setText(cnf.readConf("language")); //$NON-NLS-1$
		}
		languageCombo.setLayoutData(gd_languageCombo);

		final Label plugTextLabel = new Label(languageGroup, SWT.NONE);
		final GridData gd_plugTextLabel = new GridData(SWT.FILL, SWT.FILL, true, false);
		gd_plugTextLabel.heightHint = 24;
		plugTextLabel.setLayoutData(gd_plugTextLabel);
		plugTextLabel.setText(SetLanguage.getString("MainFrame.pluginTheTVDBLanguage")); //$NON-NLS-1$

		theTVDBcombo = new Combo(languageGroup, SWT.READ_ONLY);
		theTVDBcombo.setItems(new String[] {"", "cs", "da", "de", "el", "en", "es", "fi", "fr", "hu", "he", "it", "ja", "nl", "no", "pl", "pt", "ru", "sl", "sv", "tr", "zh"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$ //$NON-NLS-20$ //$NON-NLS-21$ //$NON-NLS-22$
		final GridData gd_theTVDBcombo = new GridData(72, SWT.DEFAULT);
		try {
			if (!cnf.readConf("thetvdb").equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
				theTVDBcombo.setText(cnf.readConf("thetvdb")); //$NON-NLS-1$
			}
		} catch(NullPointerException e) {	
		}
		theTVDBcombo.setLayoutData(gd_theTVDBcombo);

		final Label languagesSepLabel1 = new Label(languageGroup, SWT.NONE);
		new Label(languageGroup, SWT.NONE);

		final Label opensubtitlesLabel = new Label(languageGroup, SWT.NONE);
		final GridData gd_opensubtitlesLabel = new GridData(SWT.FILL, SWT.CENTER, false, false);
		opensubtitlesLabel.setLayoutData(gd_opensubtitlesLabel);
		opensubtitlesLabel.setText(SetLanguage.getString("MainFrame.openSubtitles")); //$NON-NLS-1$

		opnSbtCombo = new Combo(languageGroup, SWT.READ_ONLY);
		opnSbtCombo.setItems(new String[] {"", "alb", "ara", "arm", "ass", "bos", "bul", "cat", "chi", "hrv", "cze", "dan", "dut", "eng", "est", "per", "fin", "fre", "glg", "geo", "ger", "ell", "heb", "hin", "hun", "ice", "ind", "ita", "jpn", "kaz", "kor", "lav", "lit", "ltz", "mac", "may", "nor", "oci", "pol", "por", "pob", "rum", "rus", "scc", "slo", "slv", "spa", "swe", "tha", "tur", "ukr", "vie"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$ //$NON-NLS-20$ //$NON-NLS-21$ //$NON-NLS-22$ //$NON-NLS-23$ //$NON-NLS-24$ //$NON-NLS-25$ //$NON-NLS-26$ //$NON-NLS-27$ //$NON-NLS-28$ //$NON-NLS-29$ //$NON-NLS-30$ //$NON-NLS-31$ //$NON-NLS-32$ //$NON-NLS-33$ //$NON-NLS-34$ //$NON-NLS-35$ //$NON-NLS-36$ //$NON-NLS-37$ //$NON-NLS-38$ //$NON-NLS-39$ //$NON-NLS-40$ //$NON-NLS-41$ //$NON-NLS-42$ //$NON-NLS-43$ //$NON-NLS-44$ //$NON-NLS-45$ //$NON-NLS-46$ //$NON-NLS-47$ //$NON-NLS-48$ //$NON-NLS-49$ //$NON-NLS-50$ //$NON-NLS-51$ //$NON-NLS-52$
		final GridData gd_opnSbtCombo = new GridData(SWT.LEFT, SWT.CENTER, true, false);
		gd_opnSbtCombo.widthHint = 72;
		try {
			if (!cnf.readConf("opensubtitle").equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
				opnSbtCombo.setText(cnf.readConf("opensubtitle")); //$NON-NLS-1$
			}
		} catch(NullPointerException e) {	
		}
		opnSbtCombo.setLayoutData(gd_opnSbtCombo);

		final Label userLabel = new Label(languageGroup, SWT.NONE);
		final GridData gd_userLabel = new GridData(SWT.CENTER, SWT.CENTER, false, false);
		userLabel.setLayoutData(gd_userLabel);
		userLabel.setText(SetLanguage.getString("MainFrame.user")); //$NON-NLS-1$

		userText = new Text(languageGroup, SWT.BORDER);
		final GridData gd_userText = new GridData(SWT.LEFT, SWT.CENTER, true, false);
		gd_userText.widthHint = 130;
		try {
			if (!cnf.readConf("opnSbtUser").equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
				userText.setText(cnf.readConf("opnSbtUser")); //$NON-NLS-1$
			}
		} catch(NullPointerException e) {	
		}
		userText.setLayoutData(gd_userText);

		final Label passwordLabel = new Label(languageGroup, SWT.NONE);
		final GridData gd_passwordLabel = new GridData(SWT.CENTER, SWT.CENTER, false, false);
		passwordLabel.setLayoutData(gd_passwordLabel);
		passwordLabel.setText(SetLanguage.getString("MainFrame.password")); //$NON-NLS-1$

		passwordText = new Text(languageGroup, SWT.BORDER | SWT.PASSWORD);
		final GridData gd_passwordText = new GridData(SWT.LEFT, SWT.CENTER, true, false);
		gd_passwordText.widthHint = 130;
		try {
			if (!cnf.readConf("opnSbtPwd").equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
				passwordText.setText(cnf.readConf("opnSbtPwd")); //$NON-NLS-1$
			}
		} catch(NullPointerException e) {	
		}
		passwordText.setLayoutData(gd_passwordText);

		final Label languagesSepLabel2 = new Label(languageGroup, SWT.NONE);
		languagesSepLabel2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
		new Label(languageGroup, SWT.NONE);
		new Label(languageGroup, SWT.NONE);

		final Button saveButton3 = new Button(languageGroup, SWT.NONE);
		saveButton3.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				saveOptions();
			}
		});
		final GridData gd_saveButton3 = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
		saveButton3.setLayoutData(gd_saveButton3);
		saveButton3.setText(SetLanguage.getString("MainFrame.save")); //$NON-NLS-1$

		//Cover
		final TabItem coverTableItem = new TabItem(guiTabFolder, SWT.NONE);
		coverTableItem.setText(SetLanguage.getString("MainFrame.cover")); //$NON-NLS-1$

		final Composite coverComposite = new Composite(guiTabFolder, SWT.NONE);
		coverComposite.setLayout(new GridLayout());
		coverTableItem.setControl(coverComposite);

		final Group coverGroup = new Group(coverComposite, SWT.NONE);
		final GridData gd_coverGroup = new GridData(SWT.FILL, SWT.FILL, true, true);
		coverGroup.setLayoutData(gd_coverGroup);
		coverGroup.setLayout(new GridLayout());

		final Group enableGroup = new Group(coverGroup, SWT.NONE);
		final GridData gd_enableGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
		enableGroup.setLayoutData(gd_enableGroup);
		enableGroup.setLayout(new GridLayout());

		final Button enableCoverButton = new Button(enableGroup, SWT.CHECK);
		if (Boolean.valueOf(cnf.readConf("setCover")) == true) { //$NON-NLS-1$
			enableCoverButton.setSelection(true);
			setEnableCover.setLength(0);
			setEnableCover.append("true"); //$NON-NLS-1$
		} else {
			enableCoverButton.setSelection(false);
			setEnableCover.setLength(0);
			setEnableCover.append("false"); //$NON-NLS-1$
		}
		enableCoverButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				if (enableCoverButton.getSelection() == true) {
					setEnableCover.setLength(0);
					setEnableCover.append("true"); //$NON-NLS-1$
				}
				if (enableCoverButton.getSelection() == false) {
					setEnableCover.setLength(0);
					setEnableCover.append("false"); //$NON-NLS-1$
				}
			}
		});
		enableCoverButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
		enableCoverButton.setText(SetLanguage.getString("MainFrame.coverEnable")); //$NON-NLS-1$

		final Button disableMJBSettingsButton = new Button(enableGroup, SWT.CHECK);
		disableMJBSettingsButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

		if (Boolean.valueOf(cnf.readConf("disableMJB")) == true) { //$NON-NLS-1$
			disableMJBSettingsButton.setSelection(true);
			setDisableMJB.setLength(0);
			setDisableMJB.append("true"); //$NON-NLS-1$
		}
		if (Boolean.valueOf(cnf.readConf("disableMJB")) == false) { //$NON-NLS-1$
			disableMJBSettingsButton.setSelection(false);
			setDisableMJB.setLength(0);
			setDisableMJB.append("false"); //$NON-NLS-1$
		}

		disableMJBSettingsButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				if (disableMJBSettingsButton.getSelection() == true) {
					setDisableMJB.setLength(0);
					setDisableMJB.append("true"); //$NON-NLS-1$
					thumbPerspCombo.setEnabled(true);
					thumbLogoHDCombo.setEnabled(true);
					thumbLogoTVCombo.setEnabled(true);
					ratingCombo.setEnabled(true);
					postPerspCombo.setEnabled(true);
					postLogoHDCombo.setEnabled(true);
					postLogoTVCombo.setEnabled(true);
					//coverRunButton.setEnabled(true);
					reflectionThumbCombo.setEnabled(true);
					reflectionPostCombo.setEnabled(true);
				}
				if (disableMJBSettingsButton.getSelection() == false) {
					setDisableMJB.setLength(0);
					setDisableMJB.append("false"); //$NON-NLS-1$
					thumbPerspCombo.setEnabled(false);
					thumbLogoHDCombo.setEnabled(false);
					thumbLogoTVCombo.setEnabled(false);
					ratingCombo.setEnabled(false);
					postPerspCombo.setEnabled(false);
					postLogoHDCombo.setEnabled(false);
					postLogoTVCombo.setEnabled(false);
					//coverRunButton.setEnabled(false);
					reflectionThumbCombo.setEnabled(false);
					reflectionPostCombo.setEnabled(false);
				}
			}
		});
		disableMJBSettingsButton.setText(SetLanguage.getString("MainFrame.coverPrivateSettings")); //$NON-NLS-1$

		final Group coverSetGroup = new Group(coverGroup, SWT.NONE);
		coverSetGroup.setText(SetLanguage.getString("MainFrame.coverSettings")); //$NON-NLS-1$
		coverSetGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		final GridLayout gridLayout_7 = new GridLayout();
		gridLayout_7.numColumns = 2;
		coverSetGroup.setLayout(gridLayout_7);

		final Group coverThumbGroup = new Group(coverSetGroup, SWT.NONE);
		coverThumbGroup.setText(SetLanguage.getString("MainFrame.coverThumbnail")); //$NON-NLS-1$
		final GridData gd_coverThumbGroup = new GridData(SWT.FILL, SWT.FILL, true, true);
		coverThumbGroup.setLayoutData(gd_coverThumbGroup);
		final GridLayout gridLayout_8 = new GridLayout();
		gridLayout_8.numColumns = 2;
		coverThumbGroup.setLayout(gridLayout_8);

		//final Label thumbSepLabel = new Label(coverThumbGroup, SWT.NONE);
		//new Label(coverThumbGroup, SWT.NONE);

		final Label thumpPerspLabel = new Label(coverThumbGroup, SWT.NONE);
		thumpPerspLabel.setLayoutData(new GridData());
		thumpPerspLabel.setText(SetLanguage.getString("MainFrame.coverThumbnailPersp")); //$NON-NLS-1$

		thumbPerspCombo = new Combo(coverThumbGroup, SWT.READ_ONLY);
		//thumbPerspCombo.setItems(new String[] {"TAK", "NIE"}); //$NON-NLS-1$ //$NON-NLS-2$
		thumbPerspCombo.setItems(SetLanguage.getString("MainFrame.coverChoose").split(",")); //$NON-NLS-1$ //$NON-NLS-2$
		
		if (setDisableMJB.toString().equalsIgnoreCase("true")) { //$NON-NLS-1$
			thumbPerspCombo.setEnabled(true);
		} else {
			thumbPerspCombo.setEnabled(false);
		}
		if (Boolean.valueOf(cnf.readConf("thumbPersp")) == true) { //$NON-NLS-1$
			thumbPerspCombo.setText(SetLanguage.getString("MainFrame.coverChoosedYes")); //$NON-NLS-1$
		} else {
			thumbPerspCombo.setText(SetLanguage.getString("MainFrame.coverChoosedNo")); //$NON-NLS-1$
		}
		//thumbPerspCombo.setText("NIE"); //$NON-NLS-1$
		//thumbPerspCombo.setEnabled(false);
		final GridData gd_thumbPerspCombo = new GridData(SWT.FILL, SWT.CENTER, false, false);
		thumbPerspCombo.setLayoutData(gd_thumbPerspCombo);

		final Label reflectionThumbLabel = new Label(coverThumbGroup, SWT.NONE);
		reflectionThumbLabel.setText(SetLanguage.getString("MainFrame.coverThumbReflection")); //$NON-NLS-1$

		reflectionThumbCombo = new Combo(coverThumbGroup, SWT.READ_ONLY);
		reflectionThumbCombo.setItems(SetLanguage.getString("MainFrame.coverChoose").split(",")); //$NON-NLS-1$ //$NON-NLS-2$
		
		if (setDisableMJB.toString().equalsIgnoreCase("true")) { //$NON-NLS-1$
			reflectionThumbCombo.setEnabled(true);
		} else {
			reflectionThumbCombo.setEnabled(false);
		}
		if (Boolean.valueOf(cnf.readConf("thumbReflection")) == true) { //$NON-NLS-1$
			reflectionThumbCombo.setText(SetLanguage.getString("MainFrame.coverChoosedYes")); //$NON-NLS-1$
		} else {
			reflectionThumbCombo.setText(SetLanguage.getString("MainFrame.coverChoosedNo")); //$NON-NLS-1$
		}
		
		final GridData gd_reflectionThumbCombo = new GridData(SWT.FILL, SWT.CENTER, false, false);
		reflectionThumbCombo.setLayoutData(gd_reflectionThumbCombo);

		final Label thumbLogoHdLabel = new Label(coverThumbGroup, SWT.NONE);
		thumbLogoHdLabel.setText(SetLanguage.getString("MainFrame.coverThumbnailHDLogo")); //$NON-NLS-1$

		thumbLogoHDCombo = new Combo(coverThumbGroup, SWT.READ_ONLY);
		thumbLogoHDCombo.setItems(SetLanguage.getString("MainFrame.coverChoose").split(",")); //$NON-NLS-1$ //$NON-NLS-2$
		
		if (setDisableMJB.toString().equalsIgnoreCase("true")) { //$NON-NLS-1$
			thumbLogoHDCombo.setEnabled(true);
		} else {
			thumbLogoHDCombo.setEnabled(false);
		}
		if (Boolean.valueOf(cnf.readConf("thumbHDlogo")) == true) { //$NON-NLS-1$
			thumbLogoHDCombo.setText(SetLanguage.getString("MainFrame.coverChoosedYes")); //$NON-NLS-1$
		} else {
			thumbLogoHDCombo.setText(SetLanguage.getString("MainFrame.coverChoosedNo")); //$NON-NLS-1$
		}
		//thumbLogoHDCombo.setText("TAK"); //$NON-NLS-1$
		//thumbLogoHDCombo.setEnabled(false);
		final GridData gd_thumbLogoHDCombo = new GridData(SWT.FILL, SWT.CENTER, false, false);
		thumbLogoHDCombo.setLayoutData(gd_thumbLogoHDCombo);

		final Label thumbLogoTvLabel = new Label(coverThumbGroup, SWT.NONE);
		thumbLogoTvLabel.setText(SetLanguage.getString("MainFrame.coverThumbnailTVLogo")); //$NON-NLS-1$

		thumbLogoTVCombo = new Combo(coverThumbGroup, SWT.READ_ONLY);
		thumbLogoTVCombo.setItems(SetLanguage.getString("MainFrame.coverChoose").split(",")); //$NON-NLS-1$ //$NON-NLS-2$
		
		if (setDisableMJB.toString().equalsIgnoreCase("true")) { //$NON-NLS-1$
			thumbLogoTVCombo.setEnabled(true);
		} else {
			thumbLogoTVCombo.setEnabled(false);
		}
		if (Boolean.valueOf(cnf.readConf("thumbTVlogo")) == true) { //$NON-NLS-1$
			thumbLogoTVCombo.setText(SetLanguage.getString("MainFrame.coverChoosedYes")); //$NON-NLS-1$
		} else {
			thumbLogoTVCombo.setText(SetLanguage.getString("MainFrame.coverChoosedNo")); //$NON-NLS-1$
		}
		//thumbLogoTVCombo.setText("NIE"); //$NON-NLS-1$
		//thumbLogoTVCombo.setEnabled(false);
		final GridData gd_thumbLogoTVCombo = new GridData(SWT.FILL, SWT.CENTER, false, false);
		thumbLogoTVCombo.setLayoutData(gd_thumbLogoTVCombo);

		final Label ratingLabel = new Label(coverThumbGroup, SWT.NONE);
		ratingLabel.setText(SetLanguage.getString("MainFrame.coverThumbnailRating")); //$NON-NLS-1$

		ratingCombo = new Combo(coverThumbGroup, SWT.READ_ONLY);
		ratingCombo.setItems(SetLanguage.getString("MainFrame.coverChoose").split(",")); //$NON-NLS-1$ //$NON-NLS-2$
		
		if (setDisableMJB.toString().equalsIgnoreCase("true")) { //$NON-NLS-1$
			ratingCombo.setEnabled(true);
		} else {
			ratingCombo.setEnabled(false);
		}
		if (Boolean.valueOf(cnf.readConf("thumbRating")) == true) { //$NON-NLS-1$
			ratingCombo.setText(SetLanguage.getString("MainFrame.coverChoosedYes")); //$NON-NLS-1$
		} else {
			ratingCombo.setText(SetLanguage.getString("MainFrame.coverChoosedNo")); //$NON-NLS-1$
		}
		//ratingCombo.setText("TAK"); //$NON-NLS-1$
		//ratingCombo.setEnabled(false);
		final GridData gd_ratingCombo = new GridData(SWT.FILL, SWT.CENTER, false, false);
		ratingCombo.setLayoutData(gd_ratingCombo);

		final Group coverPerspGroup = new Group(coverSetGroup, SWT.NONE);
		coverPerspGroup.setText(SetLanguage.getString("MainFrame.coverPoster")); //$NON-NLS-1$
		coverPerspGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		final GridLayout gridLayout_9 = new GridLayout();
		gridLayout_9.numColumns = 3;
		coverPerspGroup.setLayout(gridLayout_9);
		//new Label(coverPerspGroup, SWT.NONE);

		//final Label posterSepLabel = new Label(coverPerspGroup, SWT.NONE);
		//new Label(coverPerspGroup, SWT.NONE);

		final Label postPerspLabel = new Label(coverPerspGroup, SWT.NONE);
		postPerspLabel.setText(SetLanguage.getString("MainFrame.coverPosterPersp")); //$NON-NLS-1$
		new Label(coverPerspGroup, SWT.NONE);

		postPerspCombo = new Combo(coverPerspGroup, SWT.READ_ONLY);
		postPerspCombo.setItems(SetLanguage.getString("MainFrame.coverChoose").split(",")); //$NON-NLS-1$ //$NON-NLS-2$
		
		if (setDisableMJB.toString().equalsIgnoreCase("true")) { //$NON-NLS-1$
			postPerspCombo.setEnabled(true);
		} else {
			postPerspCombo.setEnabled(false);
		}
		if (Boolean.valueOf(cnf.readConf("postPersp")) == true) { //$NON-NLS-1$
			postPerspCombo.setText(SetLanguage.getString("MainFrame.coverChoosedYes")); //$NON-NLS-1$
		} else {
			postPerspCombo.setText(SetLanguage.getString("MainFrame.coverChoosedNo")); //$NON-NLS-1$
		}
		//postPerspCombo.setText("NIE"); //$NON-NLS-1$
		//postPerspCombo.setEnabled(false);
		final GridData gd_postPerspCombo = new GridData(SWT.FILL, SWT.CENTER, false, false);
		postPerspCombo.setLayoutData(gd_postPerspCombo);

		final Label reflectionPostLabel = new Label(coverPerspGroup, SWT.NONE);
		reflectionPostLabel.setText(SetLanguage.getString("MainFrame.coverPostReflection")); //$NON-NLS-1$
		new Label(coverPerspGroup, SWT.NONE);

		reflectionPostCombo = new Combo(coverPerspGroup, SWT.READ_ONLY);
		reflectionPostCombo.setItems(SetLanguage.getString("MainFrame.coverChoose").split(",")); //$NON-NLS-1$ //$NON-NLS-2$
		
		if (setDisableMJB.toString().equalsIgnoreCase("true")) { //$NON-NLS-1$
			reflectionPostCombo.setEnabled(true);
		} else {
			reflectionPostCombo.setEnabled(false);
		}
		if (Boolean.valueOf(cnf.readConf("postReflection")) == true) { //$NON-NLS-1$
			reflectionPostCombo.setText(SetLanguage.getString("MainFrame.coverChoosedYes")); //$NON-NLS-1$
		} else {
			reflectionPostCombo.setText(SetLanguage.getString("MainFrame.coverChoosedNo")); //$NON-NLS-1$
		}
		
		final GridData gd_reflectionPostCombo = new GridData(SWT.FILL, SWT.CENTER, false, false);
		reflectionPostCombo.setLayoutData(gd_reflectionPostCombo);

		final Label perspLogoHdLabel = new Label(coverPerspGroup, SWT.NONE);
		perspLogoHdLabel.setText(SetLanguage.getString("MainFrame.coverPosterHDLogo")); //$NON-NLS-1$
		new Label(coverPerspGroup, SWT.NONE);

		postLogoHDCombo = new Combo(coverPerspGroup, SWT.READ_ONLY);
		postLogoHDCombo.setItems(SetLanguage.getString("MainFrame.coverChoose").split(",")); //$NON-NLS-1$ //$NON-NLS-2$
		
		if (setDisableMJB.toString().equalsIgnoreCase("true")) { //$NON-NLS-1$
			postLogoHDCombo.setEnabled(true);
		} else {
			postLogoHDCombo.setEnabled(false);
		}
		if (Boolean.valueOf(cnf.readConf("postHDlogo")) == true) { //$NON-NLS-1$
			postLogoHDCombo.setText(SetLanguage.getString("MainFrame.coverChoosedYes")); //$NON-NLS-1$
		} else {
			postLogoHDCombo.setText(SetLanguage.getString("MainFrame.coverChoosedNo")); //$NON-NLS-1$
		}		
		//postLogoHDCombo.setText("NIE"); //$NON-NLS-1$
		//postLogoHDCombo.setEnabled(false);
		final GridData gd_postLogoHDCombo = new GridData(SWT.FILL, SWT.CENTER, false, false);
		postLogoHDCombo.setLayoutData(gd_postLogoHDCombo);

		final Label postLogoTvLabel = new Label(coverPerspGroup, SWT.NONE);
		postLogoTvLabel.setText(SetLanguage.getString("MainFrame.coverPosterTVLogo")); //$NON-NLS-1$
		new Label(coverPerspGroup, SWT.NONE);

		postLogoTVCombo = new Combo(coverPerspGroup, SWT.READ_ONLY);
		postLogoTVCombo.setItems(SetLanguage.getString("MainFrame.coverChoose").split(",")); //$NON-NLS-1$ //$NON-NLS-2$
		
		if (setDisableMJB.toString().equalsIgnoreCase("true")) { //$NON-NLS-1$
			postLogoTVCombo.setEnabled(true);
		} else {
			postLogoTVCombo.setEnabled(false);
		}
		if (Boolean.valueOf(cnf.readConf("postTVlogo")) == true) { //$NON-NLS-1$
			postLogoTVCombo.setText(SetLanguage.getString("MainFrame.coverChoosedYes")); //$NON-NLS-1$
		} else {
			postLogoTVCombo.setText(SetLanguage.getString("MainFrame.coverChoosedNo")); //$NON-NLS-1$
		}
		//postLogoTVCombo.setEnabled(false);
		final GridData gd_postLogoTVCombo = new GridData(SWT.FILL, SWT.CENTER, false, false);
		postLogoTVCombo.setLayoutData(gd_postLogoTVCombo);

		coverRunButton = new Button(coverGroup, SWT.NONE);
		coverRunButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				genCovers();
			}
		});
		/*if (setDisableMJB.toString().equalsIgnoreCase("true")) { //$NON-NLS-1$
			coverRunButton.setEnabled(true);
		} else {
			coverRunButton.setEnabled(false);
		}*/
		final GridData gd_coverRunButton = new GridData(SWT.RIGHT, SWT.CENTER, true, false);
		gd_coverRunButton.widthHint = 120;
		coverRunButton.setLayoutData(gd_coverRunButton);
		coverRunButton.setText(SetLanguage.getString("MainFrame.coverRunButton")); //$NON-NLS-1$

		final Button coverSaveButton = new Button(coverGroup, SWT.NONE);
		coverSaveButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				saveOptions();
			}
		});
		final GridData gd_coverSaveButton = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
		gd_coverSaveButton.widthHint = 120;
		coverSaveButton.setLayoutData(gd_coverSaveButton);
		coverSaveButton.setText(SetLanguage.getString("MainFrame.coverSave")); //$NON-NLS-1$
		
		//Edit
		final TabItem editTableItem = new TabItem(guiTabFolder, SWT.NONE);
		editTableItem.setText(SetLanguage.getString("MainFrame.edit")); //$NON-NLS-1$

		final Composite editComposite = new Composite(guiTabFolder, SWT.NONE);
		editComposite.setLayout(new GridLayout());
		editTableItem.setControl(editComposite);

		final Group editGroup = new Group(editComposite, SWT.NONE);
		final GridData gd_editGroup = new GridData(SWT.FILL, SWT.FILL, true, true);
		editGroup.setLayoutData(gd_editGroup);
		editGroup.setLayout(new GridLayout());

		editTable = new Table(editGroup, SWT.BORDER);
		editTable.addMouseListener(new MouseAdapter() {
			public void mouseDoubleClick(final MouseEvent e) {
				editXMLFile();
			}
		});
		editTable.setLinesVisible(true);
		editTable.setHeaderVisible(true);
		final GridData gd_editTable = new GridData(SWT.FILL, SWT.FILL, true, true);
		editTable.setLayoutData(gd_editTable);

		final TableColumn editTableColumn = new TableColumn(editTable, SWT.NONE);
		editTableColumn.setWidth(400);
		editTableColumn.setText(SetLanguage.getString("MainFrame.editFileName")); //$NON-NLS-1$

		final Group manageEditGroup = new Group(editGroup, SWT.NONE);
		final GridData gd_manageEditGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
		manageEditGroup.setLayoutData(gd_manageEditGroup);
		final GridLayout gridLayout_3 = new GridLayout();
		gridLayout_3.numColumns = 2;
		manageEditGroup.setLayout(gridLayout_3);

		final Button searchButton = new Button(manageEditGroup, SWT.NONE);
		searchButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				searchXMLFile();
			}
		});
		final GridData gd_searchButton = new GridData(SWT.LEFT, SWT.CENTER, true, false);
		gd_searchButton.widthHint = 100;
		searchButton.setLayoutData(gd_searchButton);
		searchButton.setText(SetLanguage.getString("MainFrame.editSearch")); //$NON-NLS-1$

		final Button loadButton = new Button(manageEditGroup, SWT.NONE);
		final GridData gd_loadButton = new GridData(SWT.RIGHT, SWT.CENTER, true, false);
		gd_loadButton.widthHint = 100;
		loadButton.setLayoutData(gd_loadButton);
		loadButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				loadXMLFiles();
			}
		});
		loadButton.setText(SetLanguage.getString("MainFrame.editLoad")); //$NON-NLS-1$
		//end Edit
		
		final Group group_2 = new Group(shell, SWT.NONE);
		group_2.setLayout(new GridLayout());
		final GridData gd_group_2 = new GridData(SWT.FILL, SWT.FILL, true, false);
		gd_group_2.heightHint = 72;
		group_2.setLayoutData(gd_group_2);

		runButton = new Button(group_2, SWT.NONE);
		runButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
		runButton.setEnabled(true);
		runButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				genMenuChangeSkin();
			}
		});
		runButton.setText(SetLanguage.getString("MainFrame.changeSkin")); //$NON-NLS-1$

		final Button genMenuButton = new Button(group_2, SWT.NONE);
		genMenuButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				genMenu();
			}
		});
		final GridData gd_genMenuButton = new GridData(SWT.FILL, SWT.FILL, true, false);
		genMenuButton.setLayoutData(gd_genMenuButton);
		genMenuButton.setText(SetLanguage.getString("MainFrame.run")); //$NON-NLS-1$ //$NON-NLS-2$
		genMenuButton.setEnabled(false);
		//
		
	}

	private void addHost() {
		try {
			AddNewHost add = new AddNewHost(shell);
			//ConfigHostParser hcf = new ConfigHostParser();
		
			add.open();
		
			TableItem item = new TableItem(table, SWT.NULL);
			item.setText(0, add.getName());
			item.setText(1, "");  //$NON-NLS-1$
			item.setText(2, "");  //$NON-NLS-1$
			item.setText(3, "");  //$NON-NLS-1$
			item.setText(4, "");  //$NON-NLS-1$
			item.setText(5, SetLanguage.getString("MainFrame.disabled"));  //$NON-NLS-1$
			item.setText(6, "");  //$NON-NLS-1$
		} catch(IllegalArgumentException e) {
			
		}
	}
	
	private void delHost() {
		table.remove(table.getSelectionIndices());
		
		TableItem[] s = table.getItems();
		HostsXML xml = new HostsXML();
		
		/*if (s.length == 0) {
			saveCfgXML.add(new MenuTab("", "", "", "", "", "")); //"null;empty;empty;empty;empty;empty"); //$NON-NLS-1$
		}*/
		
		for (int i = 0; i < s.length; i++) {
			saveCfgXML.add(new MenuTab(s[i].getText(0), s[i].getText(1), s[i].getText(2), s[i].getText(3), s[i].getText(6), s[i].getText(4)));
			/*name.setLength(0);
			src.setLength(0);
			nmt.setLength(0);
			excl.setLength(0);
			sign.setLength(0);
			stat.setLength(0);
			
			if (s[i].getText(0).equals("")) { //$NON-NLS-1$
				name.append("empty"); //$NON-NLS-1$
			} else {
				name.append(s[i].getText(0));
			}
			if (s[i].getText(1).equals("")) { //$NON-NLS-1$
				src.append("empty"); //$NON-NLS-1$
			} else {
				src.append(s[i].getText(1));
			}
			if (s[i].getText(2).equals("")) { //$NON-NLS-1$
				nmt.append("empty"); //$NON-NLS-1$
			} else {
				nmt.append(s[i].getText(2));
			}
			if (s[i].getText(3).equals("")) { //$NON-NLS-1$
				excl.append("empty"); //$NON-NLS-1$
			} else {
				excl.append(s[i].getText(3));
			}
			if (s[i].getText(6).equals("")) { //$NON-NLS-1$
				sign.append("empty"); //$NON-NLS-1$
			} else {
				sign.append(s[i].getText(6));
			}
			if (s[i].getText(4).equals("")) { //$NON-NLS-1$
				stat.append("empty"); //$NON-NLS-1$
			} else {
				stat.append(s[i].getText(4));
			}
			
			saveCfgXML.add(i, name.toString() + ";" + src.toString() + ";" + nmt.toString() + ";" + excl.toString() + ";" + sign.toString() + ";" + stat.toString());		 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
			*/
		}
		xml.setSave(saveCfgXML);
		xml.saveHostValues();
	}
	
	private void openHostConfig() {
		try {
			HostConfig host = new HostConfig(shell);
			HostsXML xml = new HostsXML();
			TableItem[] s = table.getItems();
			
			host.setName(s[table.getSelectionIndex()].getText(0));
			host.setSrcDir(s[table.getSelectionIndex()].getText(1));
			host.setExclDirs(s[table.getSelectionIndex()].getText(3));
			host.setNmt(s[table.getSelectionIndex()].getText(2));
			host.setAct(s[table.getSelectionIndex()].getText(4));
			host.setNmtS(s[table.getSelectionIndex()].getText(6));
		
			host.open();
		
			s[table.getSelectionIndex()].setText(0, host.getName());
			s[table.getSelectionIndex()].setText(1, host.getSrcDir());
			s[table.getSelectionIndex()].setText(2, host.getNmt());
			s[table.getSelectionIndex()].setText(3, host.getExclDirs());
			s[table.getSelectionIndex()].setText(4, host.getAct());
			if (host.getAct().equals("enable")) { //$NON-NLS-1$
				s[table.getSelectionIndex()].setText(5, SetLanguage.getString("MainFrame.enabled")); //$NON-NLS-1$
			} else {
				s[table.getSelectionIndex()].setText(5, SetLanguage.getString("MainFrame.disabled")); //$NON-NLS-1$
			}
			s[table.getSelectionIndex()].setText(6, host.getNmtS());
			
			for (int i = 0; i < s.length; i++) {
				saveCfgXML.add(new MenuTab(s[i].getText(0), s[i].getText(1), s[i].getText(2), s[i].getText(3), s[i].getText(6), s[i].getText(4)));
				/*name.setLength(0);
				src.setLength(0);
				nmt.setLength(0);
				excl.setLength(0);
				sign.setLength(0);
				stat.setLength(0);
				myihome.setLength(0);
				
				if (s[i].getText(0).equals("")) { //$NON-NLS-1$
					name.append("empty"); //$NON-NLS-1$
				} else {
					name.append(s[i].getText(0));
				}
				if (s[i].getText(1).equals("")) { //$NON-NLS-1$
					src.append("empty"); //$NON-NLS-1$
				} else {
					src.append(s[i].getText(1));
				}
				if (s[i].getText(2).equals("")) { //$NON-NLS-1$
					nmt.append("empty"); //$NON-NLS-1$
				} else {
					nmt.append(s[i].getText(2));
				}
				if (s[i].getText(3).equals("")) { //$NON-NLS-1$
					excl.append("empty"); //$NON-NLS-1$
				} else {
					excl.append(s[i].getText(3));
				}
				if (s[i].getText(6).equals("")) { //$NON-NLS-1$
					sign.append("empty"); //$NON-NLS-1$
				} else {
					sign.append(s[i].getText(6));
				}
				if (s[i].getText(4).equals("")) { //$NON-NLS-1$
					stat.append("empty"); //$NON-NLS-1$
				} else {
					stat.append(s[i].getText(4));
				}
				if (s[i].getText(7).equals("")) {
					myihome.append("empty");
				} else {
					myihome.append(s[i].getText(7));
				}
				
				String line = name.toString() + ";" + src.toString() + ";" + nmt.toString() + ";" + excl.toString() + ";" + sign.toString() + ";" + stat.toString() + ";" + myihome.toString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
				saveCfgXML.add(i, line);*/
			}
			xml.setSave(saveCfgXML);
			xml.saveHostValues();			
		} catch(NullPointerException e) {
			
		} catch(ArrayIndexOutOfBoundsException e) {
			
		} catch(IndexOutOfBoundsException e) {
			
		} catch(NoSuchElementException e) {
			
		}
		
	}
	
	private void selectDestinationDir() {
		try {
			DirectoryDialog destDir = new DirectoryDialog(shell, SWT.OPEN);
			String destdir = destDir.open();
			destText.setText(destdir);
		} catch(java.lang.IllegalArgumentException e) {	
		}
	}
	
	private void mediaDir() {
		try {
			DirectoryDialog mediaDir = new DirectoryDialog(shell, SWT.OPEN);
			String mediadir = mediaDir.open();
			mediaText.setText(mediadir.replace("\\", "/")); //$NON-NLS-1$ //$NON-NLS-2$
		} catch(java.lang.IllegalArgumentException e) {	
		} catch(NullPointerException e) {
		}
	}

	private void saveOptions() {
		MovieJukeBoxConfig juke = new MovieJukeBoxConfig();
		
		juke.setPlugin(pluginCombo.getText());
		juke.setSkin(skinCombo.getText());
		juke.setOpensubtitle(opnSbtCombo.getText());
		juke.setOpnSbtUser(userText.getText());
		juke.setOpnSbtPwd(userText.getText());
		juke.setMedia(mediaText.getText());
		juke.setThetvdb(theTVDBcombo.getText());
		juke.setEnableCover(setEnableCover.toString());
		juke.setDisableMJB(setDisableMJB.toString());
		juke.setThumbPersp(thumbPerspCombo.getText());
		juke.setThumbRefl(reflectionThumbCombo.getText());
		juke.setThumbHDLogo(thumbLogoHDCombo.getText());
		juke.setThumbTVLogo(thumbLogoTVCombo.getText());
		juke.setThumbRating(ratingCombo.getText());
		juke.setPostPersp(postPerspCombo.getText());
		juke.setPostRefl(reflectionPostCombo.getText());
		juke.setPostHDLogo(postLogoHDCombo.getText());
		juke.setPostTVLogo(postLogoTVCombo.getText());
		
		juke.saveOptions();
	}
	
	private void properties() {
		Properties prop = new Properties(shell);
		
		prop.open();
	}
	
	private void categories() {
		Categories cat = new Categories();
		
		cat.open();
	}
	
	private void genres() {
		GenresTree g = new GenresTree(shell);
		
		g.open();
		
	}
	
	private void setGUIPath() {
		GUIPathConfig gui = new GUIPathConfig(shell);
		
		gui.open();
	}

	private void loadXMLFiles() {
		try {
			SortXMLFiles sf = new SortXMLFiles();
			
			editTable.removeAll();
			
			DirectoryDialog xmlFilesDir = new DirectoryDialog(shell, SWT.OPEN);
			String loadXML = xmlFilesDir.open();
			
			File f = new File(loadXML + File.separator);
			final String directory = loadXML;

			ListXMLFiles.clear();
			
			if (f.exists() && f.isDirectory()) {
				final String[] files = f.list();
				
				IRunnableWithProgress runProgress = new IRunnableWithProgress() {
					public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
						try {
							monitor.beginTask(SetLanguage.getString("MainFrame.progressBarLoadInfo"), files.length); //$NON-NLS-1$
							for (int i = 0; i < files.length && !monitor.isCanceled(); i++) {
								final int a = i;
								Display.getDefault().syncExec(new Runnable() {
									public void run() {
										File test = new File(directory + File.separator + files[a]);
										if (test.isFile()) {
											if (files[a].endsWith(".xml") && !files[a].startsWith("Title_") && !files[a].startsWith("Year_") && !files[a].startsWith("Other_") && !files[a].startsWith("Genres_") && !files[a].startsWith("Categories") && !files[a].startsWith("categories") && !files[a].startsWith("Rating_") && !files[a].startsWith("Set_") && !files[a].startsWith("Library_")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
												int lengthFile = files[a].length();
												int newLengthFile = lengthFile - 4;
												ListXMLFiles.add(files[a].substring(0, newLengthFile));
												//TableItem addXMLFile = new TableItem(editTable, SWT.NULL);
												//addXMLFile.setText(0, files[a].substring(0, newLengthFile));
											} 
										}
									}
								});
							monitor.worked(1);
							monitor.subTask(SetLanguage.getString("MainFrame.progress") + ((i*100)/files.length) + "%"); //$NON-NLS-1$ //$NON-NLS-2$
							if (monitor.isCanceled())
								throw new InterruptedException(SetLanguage.getString("MainFrame.cancelProgressBar")); //$NON-NLS-1$
							}
						}
						finally {
							monitor.done();
						}
					}
				};
			
				ProgressMonitorDialog progressLoad = new ProgressMonitorDialog(shell);
				progressLoad.run(true, true, runProgress);
			}
			
			//TUTAJ
			sf.setLoadData(ListXMLFiles);
			sf.sortRun();
			
			for (int a = 0; a < sf.getRow().size(); a++) {
				//System.out.println(sf.getRow().get(a).getName());
				TableItem addXMLFile = new TableItem(editTable, SWT.NULL);
				addXMLFile.setText(0, sf.getRow().get(a).getName());
			}
			
			editXMLFile.setLength(0);
			editXMLFile.append(loadXML.toString());
			
		} catch(java.lang.IllegalArgumentException e) {	
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
			e.printStackTrace();
		} catch(NullPointerException e) {
			e.printStackTrace();
		}
	}
	
	private void searchXMLFile() {
		try {
			TableItem[] s = editTable.getItems();
			Search srch = new Search(shell);
			srch.open();
		
			String word = srch.getWord();
				
			for (int i = 0; i < s.length; i++) {
				s[i].setBackground(new Color(Display.getDefault(), 255, 255, 255));
				
				if (s[i].getText(0).contains(word)) {
					s[i].setBackground(new Color(Display.getDefault(), 127, 178, 127));
				}
			}
		} catch(NullPointerException e) {
			
		}
	}
	
	private void editXMLFile() {
		Editor edit = new Editor();
		try {
			edit.setFileInputXMLName(editTable.getSelection()[0].getText());
			edit.setDirInputXMLName(editXMLFile.toString());
			
			edit.open();
			
		} catch(ArrayIndexOutOfBoundsException e) {
			
		}
	}

	private void genCovers() {
		try {
			DirectoryDialog xmlFilesDir = new DirectoryDialog(shell, SWT.OPEN);
			String loadXML = xmlFilesDir.open();
		
			File f = new File(loadXML + File.separator);
			final String directory = loadXML;
		
			if (f.exists() && f.isDirectory()) {
				final String[] files = f.list();
			
				IRunnableWithProgress runProgress = new IRunnableWithProgress() {
					public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
						try {
							monitor.beginTask(SetLanguage.getString("MainFrame.progressBarCreateInfo"), files.length); //$NON-NLS-1$
							for (int i = 0; i < files.length && !monitor.isCanceled(); i++) {
								final int a = i;
								Display.getDefault().syncExec(new Runnable() {
									public void run() {
										File test = new File(directory + File.separator + files[a]);
										if (test.isFile()) {
											CreateCoverImage ci = new CreateCoverImage();
											int l = files[a].length();
											String baseName = files[a].substring(0, l - 4);
											
											if (files[a].endsWith(".xml") && !files[a].startsWith("Title_") && !files[a].startsWith("Year_") && !files[a].startsWith("Other_") && !files[a].startsWith("Genres_") && !files[a].startsWith("Categories") && !files[a].startsWith("categories") && !files[a].startsWith("Rating_") && !files[a].startsWith("Set_") && !files[a].startsWith("Library_")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
											//if (files[a].endsWith(".jpg") && !files[a].contains(".fanart.jpg") && !files[a].contains("_small.") && !files[a].contains("_large.") && !files[a].contains("Set_")) {
												System.out.println("film: " + baseName);
												ci.createCoverImage(directory, baseName);
											}
											if (files[a].startsWith("Set_") && files[a].endsWith(".xml")) { //$NON-NLS-1$ //$NON-NLS-2$											
												System.out.println("Set: " + baseName);
												ci.createSetImage(directory, baseName);
											}
										}
									}
								});
								monitor.worked(1);
								monitor.subTask(SetLanguage.getString("MainFrame.progress") + ((i*100)/files.length) + "%"); //$NON-NLS-1$ //$NON-NLS-2$
								if (monitor.isCanceled())
									throw new InterruptedException(SetLanguage.getString("MainFrame.cancelProgressBar")); //$NON-NLS-1$
							}
						}
						finally {
							monitor.done();
						}
					}
				};
		
				ProgressMonitorDialog progressCreate = new ProgressMonitorDialog(shell);
				progressCreate.run(true, true, runProgress);
			}
		} catch(java.lang.IllegalArgumentException e) {	
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
			e.printStackTrace();
		} catch(NullPointerException e) {
			e.printStackTrace();
		}
	}
	
	private void genMenuChangeSkin() {
	}
	
	private void genMenu() {
		ShowLogs log = new ShowLogs(shell);
		//RunShowLogs sh = new RunShowLogs();
		MovieJukeBoxConfig juke = new MovieJukeBoxConfig();
		LibrariesXML lib = new LibrariesXML();
		
		juke.createProperties();
		lib.saveLibrary();	
		
		//log.setSrc(srcText.getText());
		log.setDst(destText.getText());
		log.setSkin(skinCombo.getText().toString());
		//sh.setPath(cnf.readConf("GUIpath")); //$NON-NLS-1$
		log.open();				

	}
	
}
